<%@ page contentType="text/html; charset=iso-8859-1"%>
<%@ page language="java"%>
<%@ page import="java.util.*,java.sql.*,java.math.BigDecimal,java.text.SimpleDateFormat" %>

<%@ page import="pc.util.*,pc.system.*,wstrader.*,wstrader.task.*" %>

<%
    //Users usr = Trader.getUser(request.getParameter("uid"));
	task.getRequest().setRequest(request);
	task.getResponse().setResponse(response,out);
	user.setDebug(true);
	//ResultSet rs = null;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Werner Soft</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.scroll
{
    FONT: 9pt arial;
    COLOR: #A2C5EC;
    background-color: #FFFFFF;
    border: medium none
}
</style>

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="load_date('clock_txt');">

<SCRIPT LANGUAGE="JavaScript" SRC="js/Utils.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="js/calendar.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="js/timer.js"></SCRIPT>

<script language="JavaScript">

function getCbxName(cbx)
{
	var name = cbx.name;
	return name.substr(0,name.length-1);	
}

function cbxClick(cbx)
{
	var name = getCbxName(cbx);
	setValue(name,cbx.checked ? 1 : 0);
}

function setCbx(cbx,value)
{
	if (cbx != null) {
		var name = getCbxName(cbx);
		setValue(name,value);
		cbx.checked = (value == 1);
	}
}

function setCbxById(id,value)
{
	setCbx(getObj(id),value);
}

function doPost()
{
	document.formMain.submit();
}

function doLink(linkPage)
{
	if (linkPage == "") return;
	document.formMain.action     = linkPage;
	doPost();
}

function doTask(task_id)
{
	if (task_id == null) task_id = 0;
	setValue("task_id",task_id);
	doPost();
}

function changeTerMth()
{
	var terminal_market = getValue("terminal_market");
	var obj1 = getObj("terminal_month");
	obj1.options.length = 0;
	obj1.options[0] = new Option("");
	obj1.options[0].value = "0";
	obj1.options[0].title = "";
	
	var date = new Date();
	var curMth = date.getMonth()+1;
	var Yrs = date.getYear();
//	var curYrs = Yrs;
	var curYrs = <%=Utils.getCurYear()%>;
//	numCurYrs = curYrs
//	strCurYrs = " " + numCurYrs;
	numCurYrs = curYrs;
	strCurYrs = numCurYrs.toString();

	var curYrs = strCurYrs.substring(2);
	var loop = 1
	var strMth = "";
	if (terminal_market == "NYC")
	{
		while (loop <= 10)
		{
			if ((curMth >= 1) && (curMth <= 3))
			{
				strMth = "Mar-"+curYrs;
				curMth = 3;
			}
			
			if ((curMth >= 4) && (curMth <= 5))
			{
				strMth = "May-"+curYrs;
				curMth = 5;
			}
			
			if ((curMth >= 6) && (curMth <= 7))
			{
				strMth = "Jul-"+curYrs;
				curMth = 7;
			}
			
			if ((curMth >= 8) && (curMth <= 9))
			{
				strMth = "Sep-"+curYrs;
				curMth = 9;
			}
			
			if ((curMth >= 10) && (curMth <= 12))
			{
				strMth = "Dec-"+curYrs;
				curMth = 12;
			}
			
			obj1.options[loop] = new Option(strMth);
			obj1.options[loop].value = "01-" + strMth;
			obj1.options[loop].title = strMth;			
			
			if (curMth <= 9)
			{
				curMth = curMth+2;
			}
			else
				if (curMth == 9)
				{
					curMth = curMth+3;
				}
				else
					if (curMth == 12)
					{
						curMth = 3;
						numCurYrs = numCurYrs+1;
						strCurYrs = numCurYrs.toString();
						curYrs = strCurYrs.substring(2);
					}
			loop=loop+1;
		}
		
	}
	else
	{
		while (loop <= 10)
		{
			if ((curMth >= 1) && (curMth <= 2))
			{
				strMth = "Jan-"+curYrs;
				curMth = 1;
			}
			
			if ((curMth >= 3) && (curMth <= 4))
			{
				strMth = "Mar-"+curYrs;
				curMth = 3;
			}
			
			if ((curMth >= 5) && (curMth <= 6))
			{
				strMth = "May-"+curYrs;
				curMth = 5;
			}
			
			if ((curMth >= 7) && (curMth <= 8))
			{
				strMth = "Jul-"+curYrs;
				curMth = 7;
			}

			if ((curMth >= 8) && (curMth <= 9))
			{
				strMth = "Sep-"+curYrs;
				curMth = 9;
			}			
			
			if ((curMth >= 10) && (curMth <= 11))
			{
				strMth = "Nov-"+curYrs;
				curMth = 11;
			}
			
			obj1.options[loop] = new Option(strMth);
			obj1.options[loop].value = "01-" + strMth;
			obj1.options[loop].title = strMth;			
			
			if (curMth <= 9)
			{
				curMth = curMth+2;
			}
			else
				if (curMth == 11)
				{
					curMth = 1;
					numCurYrs = numCurYrs+1;
					strCurYrs = numCurYrs.toString();
					curYrs = strCurYrs.substring(2);					
				}
			loop=loop+1;
		}	
	}
}

</script>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>           
	<td valign="top" background="images/bg-0.jpg" align="center">
		<table width="624" border="0" cellpadding="0" cellspacing="0" align="center">		  
              <tr>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td><img src="images/ws-trader.jpg"  height="56" border="0"></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
			  	<td><%for (int i = 0; i < user.getChildSize() ; i++) { Tasks ts = (Tasks)(user.getTask(i));%><img src="<%=ts.getButton().getImage()%>" width="78" height="28" onClick="doLink('<%=ts.doLink()%>')"><%}%></td>
              </tr>
              <tr>
			  	<td height="21" valign="top">
<%	
	Tasks t2 = (Tasks)user.getTaskLevel(0); 
	Tasks t3 = (Tasks)user.getTaskLevel(1); 
	for (int i = 0; (t2 != null) && (i < t2.getChildSize()) ; i++) {
			Tasks ts = t2.getTask(i);
%>
					<img src="<%=ts.getButton().getImage()%>" border="0" onClick="doLink('<%=ts.doLink()%>')">
<%
	}
%></td>
			  </tr>
      </table></td>
  </tr>
</table>
<table width="900" align="center">
	<tr style="font-family:Arial, Helvetica, sans-serif;font-size:11px">
		<td height="10" align="right"><label id="clock_txt" style="color:#BBBBBB">&nbsp;</label></td>
	</tr>
</table>
<table width="900" height="" border="0" align="center" bgcolor="#BBBBBB">
	<tr>
		<td width="100" height="100%" valign="top" style="display:<%=(t3==null || t3.getChildSize()==0)?"none":""%>" bgcolor="#EEEEEE">
		<div align="justify" id="sub_menu" style="BORDER:0px ; OVERFLOW:; WIDTH: 100%; HEIGHT: 100%; display:;">      
		<table height="100%" width="100%">
			<tr valign="top">
				<td height="21">
<%	
	for (int i = 0; (t3 != null) && (i < t3.getChildSize()) ; i++) {
		Tasks ts = t3.getTask(i);
%>				
					<img height="21" src="<%=ts.getButton().getImage()%>" border="0" onClick="doLink('<%=ts.doLink()%>')">
<%
	}
%>					
				</td>
			</tr>
		</table>
		</div>
		</td>

		<td  valign="top" bgcolor="#FBFBF5" background="images/ws-background.jpg"><table width="100%" height="100%" border="0">
			<tr valign="top">
				<td><!-- This area for the contents of body-->
<% if (false) {%>
				</td>
			</tr>
		</table></td>
	</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td height="30" align="center" valign="middle" style="font-family:Arial, Helvetica, sans-serif;font-size:10px">Copyright &copy; 2005 Werner Soft Pte Ltd., All rights reserved.</td>
  </tr>
</table>

</body>
</html>

<%}%>